package com.android.rutaszalagarda;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.Button;

public class NuevaRuta extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_nueva_ruta);
		
		//Creamos el objeto animate para los botones
		final Animation animTranslate = AnimationUtils.loadAnimation(this, R.anim.anim_translate);
		
		//Obtenemos una referencia a los controles de la interfaz
        final Button btnDesdeFichero = (Button)findViewById(R.id.BtnDesdeFichero);
        final Button btnPorCoordenadas = (Button)findViewById(R.id.BtnPorCoordenadas);
        final Button btnGrabacionPorGPS = (Button)findViewById(R.id.BtnGrabacionPorGPS);
        
        //DESDE FICHERO
        btnDesdeFichero.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) {
        		//	Transiciones visuales
        		btnDesdeFichero.startAnimation(animTranslate);
        		
        		animTranslate.setAnimationListener(new AnimationListener() {
                    public void onAnimationStart(Animation anim){
                   	 
                    };
                    public void onAnimationRepeat(Animation anim){
                   	 
                    };
                    public void onAnimationEnd(Animation anim){
                    	Intent intent = new Intent(NuevaRuta.this, Home.class); 
                		startActivity(intent);
                    };
                });           		
        	}
        });
      //POR COORDENADAS
        btnPorCoordenadas.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) {
        		//	Transiciones visuales
        		btnPorCoordenadas.startAnimation(animTranslate);
        		
        		animTranslate.setAnimationListener(new AnimationListener() {
                    public void onAnimationStart(Animation anim){
                   	 
                    };
                    public void onAnimationRepeat(Animation anim){
                   	 
                    };
                    public void onAnimationEnd(Animation anim){
                    	Intent intent = new Intent(NuevaRuta.this, NRPorCoordenadas.class); 
                		startActivity(intent);
                    };
                });           		
        	}
        });
      //GRABACION POR GPS
        btnGrabacionPorGPS.setOnClickListener(new OnClickListener() {
        	public void onClick(View v) {
        		//	Transiciones visuales
        		btnGrabacionPorGPS.startAnimation(animTranslate);
        		
        		animTranslate.setAnimationListener(new AnimationListener() {
                    public void onAnimationStart(Animation anim){
                   	 
                    };
                    public void onAnimationRepeat(Animation anim){
                   	 
                    };
                    public void onAnimationEnd(Animation anim){
                    	Intent intent = new Intent(NuevaRuta.this, NRGrabacionGPS.class); 
                		startActivity(intent);
                    };
                });           		
        	}
        });
	}
	
}